
$(function () {

    $('#login').validate({

        rules: {
            nickname:{
                required:true,
                minlength: 2,
                maxlength: 10
            },
            username: {
                required:true,
                minlength: 6,
                maxlength: 16
                   },

           password: {
               required:true,
               minlength: 6,
               maxlength: 16
                    }
           },
           messages:{
            username:{
                required:'请填写用户名信息',
                minlength:'最少输入6个字符',
                maxlength:'最多输入16个字符'
            }
        },
        submitHandler (form){
            let opp = $('#password').val()
            let obb = $('#opp').val()
            if(opp !== obb) {
                $('.p').removeClass('hide')
                return
            }
            $('.p').addClass('hide')

            const info = $(form).serialize()
            console.log(info)
            alert('恭喜您，注册成功 现在可以去登录啦')
            window.location.href = '../html/denglu.html'

            $.get('../php/zhuce.php',info , null , 'json' )
        }

    })
    




})